<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\web\View;
use kartik\date\DatePicker;

/* @var $this yii\web\View */
/* @var $model app\models\Dormchangeinfo */
/* @var $form yii\widgets\ActiveForm */

$url=\Yii::getAlias('@web');
$js3=<<< Js
function myAjax(){
		var x=$("#dormchangeinfo-stu_id").val();
		$.ajax({
                    url: '$url/dormchangeinfo/getname?stuid='+x,
                    type: 'get',
                    dataType: 'text',
                    success: function (data) {
                       $("#dormchangeinfo-stu_name").val(data);
                    }
                });
}
Js;
$this->registerJs($js3, View::POS_END, 'myAjax0');

?>

<div class="dormchangeinfo-form">

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'stu_id')->textInput(['maxlength' => true,'onblur'=>'myAjax()',]) ?>

    <?= $form->field($model, 'stu_name')->textInput(['maxlength' => true,'readonly'=>true])?>

    <?= $form->field($model, 'time')->widget(DatePicker::classname(), [
        'options' => ['placeholder' => 'Enter birth date ...'],
        'pluginOptions' => [
            'autoclose'=>true,
            'format' => 'yyyy.mm.dd'
        ]
    ])->label('变动时间'); ?>

    <?= $form->field($model, 'type')->dropDownList(['外宿'=>'外宿','申请住宿'=>'申请住宿','调整宿舍'=>'调整宿舍','入学分配'=>'入学分配','离校回收'=>'离校回收']) ?>

    <?= $form->field($model, 'before_num')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'before_floor')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'after_num')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'after_floor')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'remark')->textInput(['maxlength' => true]) ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? '添加' : '修改', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
